package com.dq.domain.service.centre;

import com.dq.domain.base.BaseEntity;
import com.dq.domain.service.ServiceProject;
import com.dq.domain.sys.user.user.BossUser;
import com.dq.domain.sys.user.user.StaffUser;
import com.dq.domain.sys.user.user.base.SysUser;
import com.dq.vo.baseVo.VO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Author luchangtong
 * @Date 2020/4/3 9:51
 */
@Data
@Entity
@ApiModel("服务项目和技师管理表")
public class StaffUserServiceProjectCentre extends BaseEntity implements VO.ToVO{

    @ApiModelProperty("技师")
    @ManyToOne
    protected SysUser staffUser;
    @ApiModelProperty("服务项目")
    @ManyToOne
    protected ServiceProject serviceProject;

    @Data
    public static class Vo implements VO{
        public Long id;
        public Long staffUserId;
        @ApiModelProperty("用户真实姓名")
        protected String userRealcName;
        @ApiModelProperty("上班时间")
        protected String startTime;
        @ApiModelProperty("下班时间")
        protected String endTime;
        @ApiModelProperty("目标业绩")
        protected BigDecimal target;
        protected BigDecimal averageScore;
        @ApiModelProperty("标签(数目)")
        protected List<String> lableStrList;
        protected String headImg;

        @ApiModelProperty("服务项目id")
        public Long serviceProjectId;
        @ApiModelProperty("服务项目编号")
        protected String projectNo;

        @ApiModelProperty("服务项目名称")
        protected String projectName;

        @ApiModelProperty("服务项目价格")
        protected BigDecimal projectPrice;

        @ApiModelProperty("服务项目描述")
        protected String projectDescription;
        @ApiModelProperty("服务手工费")
        protected BigDecimal projectManualPrice;
        @ApiModelProperty("图片")
        protected String imgUrl;
        @ApiModelProperty("服务时间")
        protected Long serviceTime;

    }
    @Override
    public VO toVO(boolean isRecursion) {
        Vo vo = new Vo();
        vo.id = this.getId();
        vo.staffUserId = this.getStaffUser() != null ? this.getStaffUser().getId() : null;
        vo.userRealcName = this.getStaffUser() != null ? this.getStaffUser().getUserRealcName() : null;
        vo.headImg = this.getStaffUser() != null ? this.getStaffUser().getHeadImg():"";
        BossUser bossUser = (BossUser) this.getStaffUser();
        vo.startTime = bossUser != null ? bossUser.getStartTime():"";
        vo.endTime = bossUser != null ? bossUser.getEndTime():"";
        vo.averageScore = bossUser != null ? bossUser.getAverageScore():null;

        vo.serviceProjectId = this.getServiceProject() != null ? this.getServiceProject().getId() : null;
        vo.projectNo = this.getServiceProject() != null ? this.getServiceProject().getProjectNo() : "";
        vo.projectName = this.getServiceProject() != null ? this.getServiceProject().getProjectName() : "";
        vo.projectPrice = this.getServiceProject() != null ? this.getServiceProject().getProjectPrice() : null;
        vo.projectDescription = this.getServiceProject() != null ? this.getServiceProject().getProjectDescription() : "";
        vo.projectManualPrice = this.getServiceProject() != null ? this.getServiceProject().getProjectManualPrice() : null;
        vo.imgUrl = this.getServiceProject() != null ? this.getServiceProject().getImgUrl() : "";
        vo.serviceTime = this.getServiceProject() != null ? this.getServiceProject().getServiceTime() : null;
        return vo;
    }
}
